<!-- Gallery -->
<?php $javascript->link('jquery-1.3.2.min', false); ?>
<?php $javascript->link('slimbox2', false); ?>
<?php echo $html->css('slimbox2',false);  ?>
<!-- End Gallery -->
<?php
$mapOptions= array(
	'width'=>'700px',
	'height'=>'500px',
	'zoom'=>14,
	'type'=>'HYBRID', //ROADMAP - SATELLITE - HYBRID - TERRAIN
	'latitude'=>40.69847032728747,
	'longitude'=>-1.9514422416687,
	'localize'=>true,
	'marker'=>true,
	'markerIcon'=>'http://google-maps-icons.googlecode.com/files/home.png',
	'infoWindow'=>true,
	'windowText'=>'My Position'
	);?>

<br><br>

<div id="googlemappy">
<?php echo $googleMapV3->map($mapOptions); ?>You are watching...<?php echo $watching; ?></div>


Welcome, <?php echo $this->Facebook->show_name();?>
<div id="friendslist"><?php $jellyfriends = $this->Facebook->get_jelly_friends();
echo "Friends on JellyFish...<br><br>";
foreach($jellyfriends as $friend){
       echo "<li>" . $html->link($this->Facebook->get_name_from_id($friend),array("controller"=>"posts","action"=>"index",$friend)) . "</li>";
}?>
<br>
       <li><? echo $html->link("Show All",array("controller"=>"posts","action"=>"index")); ?></li>
</div>
 <?php
	foreach ($posts as $post){
		$markerOptions= array(

			'id'=>$post['Post']['id'],
			'latitude'=>$post['Point']['latitude'],
			'longitude'=>$post['Point']['longitude'],		
			'infoWindow'=>true,
		);
		if(isset($post['Image'][0]['Thumbnail']["path_small"])){
			$user_name=$this->Facebook->get_name_from_id($post["Post"]["fb_user_id"]);
			$markerOptions=array_merge($markerOptions, array('markerIcon'=>'http://www.jellyfish.marcfg.com/img/'.$post['Image'][0]['Thumbnail']["path_small"]));
			$markerOptions=array_merge($markerOptions, array('windowText'=>"<table id=\"window_info\"><tr><td id=\"info_title\" colspan=\"2\">".$post["Post"]["title"]."</td></tr><tr><td id=\"info_picture\" colspan=\"2\"><a href=\"/posts/view/".$post["Post"]["id"]."\"><img src=\"http://www.jellyfish.marcfg.com/img/".$post["Image"][0]["Thumbnail"]["path_big"]."\" width=\"200\" height=\"200\" /></a></td></tr><tr><td id=\"info_logo\" width=\"50%\">JellyFish</td><td id=\"info_user\" width=\"50%\">by ".$user_name."</td></tr></table>"));	
		}else{
			$markerOptions=array_merge($markerOptions, array('windowText'=>"<table id=\"window_info\"><tr><td id=\"info_title\" colspan=\"2\">".$post["Post"]["title"]."</td></tr><tr><td id=\"info_picture\" colspan=\"2\"><a href=\"/posts/view/".$post["Post"]["id"]."\"><img src=\"http://www.jellyfish.marcfg.com/img/no_image.gif\" width=\"200\" height=\"200\" /></a></td></tr><tr><td id=\"info_logo\" width=\"50%\">JellyFish</td><td id=\"info_user\" width=\"50%\">by Marc</td></tr></table>"));		
		}
		echo $googleMapV3->addMarker($markerOptions);	
	}
?> 
<div id="headlast"></div>
	<div id="lastrecentplaces">
<table>
<?php foreach($lastTen as $post){ ?>
	<tr>

		<td><?php 
			if(isset($post['Image'][0]['Thumbnail']["path_small"])){
				echo $html->link($html->image($post['Image'][0]['Thumbnail']["path_small"]),"../img/".$post['Image'][0]['path'],array("rel"=>"lightbox", 'title'=>$post['Post']["title"]."<br>".$post['Post']["description"],'escape'=>false));
			}else{
				echo $html->image("no_image.gif", array('width'=>40, 'height'=>40));
			}
		//if(isset($post['Image'][0]['Thumbnail']["path_small"])) echo $html->image($post['Image'][0]['Thumbnail']['path_small']); else echo $html->image("no_image.gif", array('width'=>200, 'height'=>200)); ?></td>
		<td align="left"><?php echo "<b>".$html->link($this->Facebook->get_name_from_id($post["Post"]["fb_user_id"]),array("controller"=>"posts","action"=>"index",$post["Post"]["fb_user_id"]))."</b> has recently been to...".$html->link($post['Post']["title"],"javascript:clickLastTen(".$post['Point']['latitude'].",".$post['Point']['longitude'].")"); ?></td>
	</tr>
<?php } ?>
</table>
</div>


<script>
function clickLastTen(lat,lon){
	map.setCenter(new google.maps.LatLng(lat, lon));
	map.setZoom(15);
}
</script>
